if(CONFIG_HAS_NORDIC_DRIVERS)
  zephyr_include_directories(drivers)

  add_subdirectory(drivers)
endif()

if(CONFIG_HAS_NRFX)
  zephyr_include_directories(nrfx)
  zephyr_include_directories(nrfx/drivers/include)
  zephyr_include_directories(nrfx/hal)
  zephyr_include_directories(nrfx/mdk)
  zephyr_include_directories(.)

  # Define MDK defines globally
  zephyr_compile_definitions_ifdef(CONFIG_SOC_SERIES_NRF51X NRF51)
  zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF52810      NRF52810_XXAA)
  zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF52832      NRF52832_XXAA)
  zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF52840      NRF52840_XXAA)

  zephyr_sources_ifdef(CONFIG_SOC_SERIES_NRF51X nrfx/mdk/system_nrf51.c)
  zephyr_sources_ifdef(CONFIG_SOC_NRF52810      nrfx/mdk/system_nrf52810.c)
  zephyr_sources_ifdef(CONFIG_SOC_NRF52832      nrfx/mdk/system_nrf52.c)
  zephyr_sources_ifdef(CONFIG_SOC_NRF52840      nrfx/mdk/system_nrf52840.c)

  zephyr_sources(nrfx_glue.c)

  zephyr_sources_ifdef(CONFIG_NRFX_PRS     nrfx/drivers/prs/nrfx_prs.c)

  zephyr_sources_ifdef(CONFIG_NRFX_ADC     nrfx/drivers/src/nrfx_adc.c)
  zephyr_sources_ifdef(CONFIG_NRFX_CLOCK   nrfx/drivers/src/nrfx_clock.c)
  zephyr_sources_ifdef(CONFIG_NRFX_GPIOTE  nrfx/drivers/src/nrfx_gpiote.c)
  zephyr_sources_ifdef(CONFIG_NRFX_NFCT    nrfx/drivers/src/nrfx_nfct.c)
  zephyr_sources_ifdef(CONFIG_NRFX_PPI     nrfx/drivers/src/nrfx_ppi.c)
  zephyr_sources_ifdef(CONFIG_NRFX_PWM     nrfx/drivers/src/nrfx_pwm.c)
  zephyr_sources_ifdef(CONFIG_NRFX_QDEC    nrfx/drivers/src/nrfx_qdec.c)
  zephyr_sources_ifdef(CONFIG_NRFX_RTC     nrfx/drivers/src/nrfx_rtc.c)
  zephyr_sources_ifdef(CONFIG_NRFX_SAADC   nrfx/drivers/src/nrfx_saadc.c)
  zephyr_sources_ifdef(CONFIG_NRFX_SPI     nrfx/drivers/src/nrfx_spi.c)
  zephyr_sources_ifdef(CONFIG_NRFX_SPIM    nrfx/drivers/src/nrfx_spim.c)
  zephyr_sources_ifdef(CONFIG_NRFX_SPIS    nrfx/drivers/src/nrfx_spis.c)
  zephyr_sources_ifdef(CONFIG_NRFX_SYSTICK nrfx/drivers/src/nrfx_systick.c)
  zephyr_sources_ifdef(CONFIG_NRFX_TIMER   nrfx/drivers/src/nrfx_timer.c)
  zephyr_sources_ifdef(CONFIG_NRFX_TWI     nrfx/drivers/src/nrfx_twi.c)
  zephyr_sources_ifdef(CONFIG_NRFX_TWIM    nrfx/drivers/src/nrfx_twim.c)
  zephyr_sources_ifdef(CONFIG_NRFX_UART    nrfx/drivers/src/nrfx_uart.c)
  zephyr_sources_ifdef(CONFIG_NRFX_UARTE   nrfx/drivers/src/nrfx_uarte.c)
  zephyr_sources_ifdef(CONFIG_NRFX_USBD    nrfx/drivers/src/nrfx_usbd.c)
  zephyr_sources_ifdef(CONFIG_NRFX_WDT     nrfx/drivers/src/nrfx_wdt.c)
endif()
